TRANSACTIONS PLUGIN
--------------------
Authors: Mike Barlow

----------------
MY TRANSACTIONS
----------------

Within the plugin is the ability to show the users transactions in their My Account section. This is all setup within the plugin as long any needed configuration is done for the listing page. See step 6 of readme - installation.txt.

Then all you need to do is place the following link where you want the user to be able to view transactions.

	echo $this->Html->link(
		'View Transactions',
		array(
			'plugin' => 'transactions',
			'controller' => 'transactions',
			'action' => 'my_transactions'
		)
	);

Styling may be required for this, the following templates are used:

Transactions/View/Transactions/my_transactions.ctp 		-- Main listing of transactions
Transactions/View/Elements/transactions_list.ctp 		-- This is also used in the admin view however so be careful when styling


-----------------------
Admin Transactions Tab
-----------------------

In order to setup the transactions tab to allow you to view transactions per user in the admin area, you will first need to set the template (if you're not already doing so) of the UsersController::admin_edit function to

	$this->view = 'admin_form';

As default, it will be running through the scaffolding.
You will then need to create this new admin_form template in:

	app/View/Themed/Admin/Users/admin_form.ctp

And place the contents as

<?php
	$this->extend('/Scaffolds/admin_form');

	$this->append('additionalFormTabs');

	echo $this->Element('Transactions.transaction_request_action');

	$this->end();

----

If you already have the admin_form template redefined and are using the additionalFormTabs view block functionality, the only line you will need to copy is:

	echo $this->Element('Transactions.transaction_request_action');


These lines should create a tab labeled transactions where the admin will get a receipt view and also a details view with a breakdown of the items as well as a refund form. The refund form currently does nothing other then mark the transaction as refunded. Meaning an admin will have to visit their stripe / sagepay admin to refund the transaction then login to the site backend, find the user and the correct transaction and then set the refund to keep the site records up to date.

-------------------------
Transaction Relationships
-------------------------
Transactions can be associated to any model using the config settings. 

The first asscociation setting, `transactionRelation`, is to associate the whole transaction with a specific model. If you are using `EvCheckout` then the `transactionRelation` will need to be configured to use the order model e.g.

    'transactionRelation' => array( // any needed relationships for the model / model_id fields on transactions (always the hasOne type)
		'Order' => array(
			'className' => 'EvCheckout.Order',
			'foreignKey' => 'model_id',
			'conditions' => array(
				"Transaction.model = 'EvCheckout.Order'"
			)
		)
	),
	
The second association setting, `transactionsItemRelation`, is to associate the items in a transaction with a specific model. 
